<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/mytag.jspf"%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<title>用户管理</title>
<script type="text/javascript">
$(function() {
	$("form").validate({
		rules : {
			"account" : {
				required : true,
				isUserName : true,
				remote : { // 异步验证是否存在
					type : "POST",
					url : 'management/backstageuser/isExist',
					data : {
						account : function() {
							return $("#account").val();
						},
						id : function() {
							return $("#id").val();
						}
					}
				}
			},
			"phone" : {
				isContact : true
			}
		},
		messages : {
			"account" : {
				required : "请输入账号",
				remote : "该账号已经存在"
			}
		}
	});
	$("#submitBtn").on("click",function(){
		$("#form").submit();
	});
});


var layerPage;//弹出框关闭时用到
	function showShopTree() {
		layerPage = layer.open({
			title : "选择门店",
			type : 2,
			content : 'management/shop/shopTree'
		});
	}
	function showTreeData(treeNode){
		$("#shopName").val(treeNode.name);
		$("#shopId").val(treeNode.id);
	}
</script>
</head>
<body>
	<ol class="am-breadcrumb am-breadcrumb-slash am-padding" style="margin-bottom: 0px;">
		<li><a href="management/index">首页</a></li>
		<li><a href="management/backstageuser/index">用户管理</a></li>
		<li class="am-active">修改</li>
	</ol>
	<div class="am-g">
		<div class="am-u-md-12">
				<div class="am-tabs am-margin">
					<ul class="am-tabs-nav am-nav am-nav-tabs">
						<li class="am-active"><a href="javascript:void(0)">基本信息</a></li>
					</ul>
					<div class="am-tabs-bd">
						<div class="am-tab-panel am-active">
							<div class="am-g">
								<div class="am-u-md-12">
									<form class="am-form am-form-horizontal" id="form" name="form"  method="post" action="management/backstageuser/update">
									<input id="id" name="backstageUserId" type="hidden" value="${t.backstageUserId }">
									<input id="passwd" name="passwd" type="hidden" value="${t.passwd }">
									<input id="compId" name="compId" type="hidden" value="${t.compId }">
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">账号</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="account" name="account" value="${t.account}" class="am-form-field am-input-sm" maxlength="20">
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">所属门店</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="shopName" name="shopName" value="${t.shopName}" class="am-form-field am-input-sm" readonly onclick="showShopTree();">
											<input type="hidden" id="shopId" name="shopId" value="${t.shopId}" class="am-form-field am-input-sm">
										</div>
										<label class="am-u-sm-1 am-form-label am-u-end am-text-left">
											<a href="javascript:void(0);" onclick="showShopTree(); return false;">选择</a>
										</label>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">姓名</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="name" name="name" value="${t.name}" class="am-form-field am-input-sm" maxlength="20">
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">联系电话</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="phone" name="phone" value="${t.phone}" class="am-form-field am-input-sm" maxlength="20">
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">性别</label>
										<div class="am-u-md-4 am-u-end">
											<t:dictSelect colName="sex" field="sex" defaultVal="${t.sex}"></t:dictSelect>
										</div>
									</div>								
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="am-margin">
					<button class="am-btn am-btn-primary am-btn-xs" type="button" id="submitBtn"><span class="am-icon-check"></span> 保存</button>
					<a href="javascript:;" onClick="javascript:history.back(-1);" class="am-btn am-btn-primary am-btn-xs"><span class="am-icon-times"></span> 取消</a>
				</div>
		</div>
	</div>
</body>
</html>
